<?php
	Class Attachment extends MessagesAppModel
	{
		var $name = 'Attachment';
		
		var $actsAs = array(
						'Cms.Upload'=>array(
							'name' => array("dir"=>'{WWW_ROOT}{DS}uploads{DS}attachments',
											'mediaTypes'=>array("Image","Text"))
							));
		
		var $fieldProperties = array(
								'name'=>array(
										'type'=>"file",
										"label"=>"Attachment"
										)
								);
		var $additionalFields = array("file_url");
		
		function file_url($attachment)
		{
			$url = false;
			if(isset($attachment[$this->alias]['name']))
			{
				$url = "/uploads/attachments/".$attachment[$this->alias]['name'];
			}
			return $url;
		}
	}
?>